import request from "@/request";

export function proListRequest() {
  return request({
    url: "/admin/pro/getCategory",
    method: "get"
  });
}
export function adviseRequest() {
  return request({
    url: "/admin/pro/showdata",
    method: "post",
    data: {
      type: 'isrecommend',
      flag: 3,

    }
  });
}
export function productRequest(category: string, page: number = 1, limitNum: number = 8) {
  return request({
    url: "/admin/pro/list",
    method: "get",
    params: {
      count: page,
      limitNum,
      category
    }
  });
}


export function productDetail(id: string) {
  return request({
    url: `/admin/pro/detail`,
    method: "get",
    params: {
      proid: id
    }
  });
}

export function productAdd(proname: string, originprice: number, desc: string, brand: string, category: string, img1: string, img2: string, img3: string, img4: string) {
  return request({
    url: `/admin/pro/product`,
    method: "post",
    data: {
      proname,
      originprice,
      desc,
      brand,
      category,
      img1,
      img2,
      img3,
      img4,
    }
  });
}

export function productDetel(id: string) {
  return request({
    url: `/admin/pro/product/`+id,
    method: "delete",
    data: {
      proid: id
    }
  });
}
